package com.wjerp.tplus.server.domain.service.impl;

import com.wjerp.tplus.server.domain.entity.sys.RolePermissionRelation;
import com.wjerp.tplus.server.domain.mapper.RolePermissionRelationMapper;
import com.wjerp.tplus.server.domain.service.RolePermissionRelationService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author lishuailei
 */
@Service
public class RolePermissionRelationServiceImpl implements RolePermissionRelationService {

    @Resource
    private RolePermissionRelationMapper rolePermissionRelationMapper;

    @Override
    public Boolean deleteRolePermissionByRoleId(Long roleId) {
        return rolePermissionRelationMapper.deleteByRoleId(roleId) > 0;
    }

    @Override
    public Boolean saveRolePermissionRelation(RolePermissionRelation data) {
        data.setCreatedTime(new Date());
        return rolePermissionRelationMapper.insertSelective(data)>0;
    }
}
